﻿using MediatR;
using T_Material.Domain;
using T_Material.Infrastructure.ImpI;
using T_Material.Infrastructure.Interface;
using T_Material.Read.API.Application.Commands.PurchaseCommand;
using T_Material.Read.API.Application.Commands.RequisitionCommand;

namespace T_Material.Read.API.Application.CommandHandlers.RequisitionHandler
{
    public class RequisitionInfoCommandHandler : IRequestHandler<RequisitionInfoCommand, Requisition>
    {
        private readonly IRequisitionRepository requisitionRepository;
        public RequisitionInfoCommandHandler(IRequisitionRepository requisitionRepository)
        {
            this.requisitionRepository = requisitionRepository;
        }
        public async Task<Requisition> Handle(RequisitionInfoCommand request, CancellationToken cancellationToken)
        {
            var info = await requisitionRepository.Get(request.Id);
            return info;
        }
    }
}
